package vcp.gui.panels;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import db.parking.beans.ParkingLot;
import vcp.gui.components.VCPFrame;
import vcp.gui.components.VCPPanel;

/**
 * Parking cell part of the parking level gui widget
 *
 */
public class pnlCellPane extends VCPPanel {
    private VCPPanel editPane;
    ParkingLot pl;
    private int ppx;
    private int ppy;
    private int state;
	private static final long serialVersionUID = 7758528416087295319L;
    public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public int getPpX() {
		return ppx;
	}
	public void setPpX(int x) {
		this.ppx = x;
	}
	public int getPpY() {
		return ppy;
	}
	public void setPpY(int y) {
		this.ppy = y;
	}
	/**
	 * Create the cell
	 * @param pl
	 * @param c
	 * @param i
	 * @param j
	 * @param state
	 */
	public pnlCellPane(ParkingLot pl, Color c, int i, int j, int state) {
    	setBackground(c);
    	this.pl = pl;
    	this.setPpX(j);
    	this.setPpY(i);
    	this.setState(state);
    	///System.out.println(this.pl.getFlorNum());
    }
    private VCPFrame getFrame(){
    	return this.getParentFrame();
    }
    
    public VCPPanel getEditPane() {
		return editPane;
	}

	public void setEditPane(VCPPanel editPane) {
		this.editPane = editPane;
	}

	@Override
    public Dimension getPreferredSize() {
		int width = getFrame().getWidth()-270;
		int height = getFrame().getHeight()-180;
        return new Dimension(width/pl.getX(), height/pl.getY());
    }
	
	public ParkingLot getPl() {
		return pl;
	}
	
}